//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#include "randomcolor.h"
//
namespace model
{
RandomColor::Data::Data(int p_type)
:
   MultiTypeData(p_type)
{
}
//
RandomColor::RandomColor()
{
}
RandomColor::RandomColor(Data *p_data)
:
   MultiTypeDataContainer(p_data)
{
}
//
const RandomColor::Data &RandomColor::data()const
{
   Q_ASSERT(get_type()!=type_null);
   return *static_cast<const Data*>(get_data());
}
const RandomColor::Constant &RandomColor::as_constant()const
{
   Q_ASSERT(get_type()==type_constant);
   return *static_cast<const Constant*>(get_data());
}
RandomColor::Constant &RandomColor::as_constant()
{
   Q_ASSERT(get_type()==type_constant);
   return *static_cast<Constant*>(get_data());
}
//
MultiTypeData *RandomColor::create_data(int p_type)const
{
   switch(p_type)
   {
   case type_constant:
      return new Constant;
   default:
      return 0;
   }
   return 0;
}
}
